package com.xidian.yunwudemo.service.impl;

import com.xidian.yunwudemo.dto.AuthUserInfoDto;
import com.xidian.yunwudemo.entities.DataUserAuth;
import com.xidian.yunwudemo.entities.PersonalUser;
import com.xidian.yunwudemo.mapper.master.DataUserAuthMapper;
import com.xidian.yunwudemo.mapper.master.PersonalUserMapper;
import com.xidian.yunwudemo.mapper.second.AuthUserInfoMapper;
import com.xidian.yunwudemo.service.UserService43Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService43ServiceImpl implements UserService43Service {

    @Autowired(required = false)
    PersonalUserMapper personalUserMapper;

    @Autowired(required = false)
    DataUserAuthMapper dataUserAuthMapper;

    @Autowired
    AuthUserInfoMapper authUserInfoMapper;


    @Override
    public List<AuthUserInfoDto> listAllPersonalUsersInfo() {
        return authUserInfoMapper.getAllUsersInfo();
    }

    @Override
    public AuthUserInfoDto getPersonalUserInfoById(Integer id) {
        return authUserInfoMapper.getUserInfoById(id);
    }

    @Override
    public boolean addPersonalUserInfo(PersonalUser user) {
        return personalUserMapper.addUserInfo(user);
    }

    @Override
    public boolean updatePersonalUserInfo(AuthUserInfoDto user) {
        return authUserInfoMapper.updateUserInfoById(user);
    }

    @Override
    public boolean deletePersonalUserInfo(Integer id) {
        return authUserInfoMapper.deleteUserInfoById(id);
    }

    @Override
    public List<DataUserAuth> listAllAuthData() {
        return dataUserAuthMapper.getAllAuthRecords();
    }

    @Override
    public List<AuthUserInfoDto> filterByName(String userName) {
        return authUserInfoMapper.filterByName(userName);
    }
}
